
// Type - 1
@Component
@RabbitListener(queues = RabbitConfig.QUEUE_A)
public class MsgConsumer {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @RabbitHandler
    public void process(String content) {
        logger.info("接收处理队列A当中的消息： " + content);
    }

}



// Type - 2
@RabbitMQListener(bindings = @QueueBinding(
     exchange = @Exchange(value = "exchange-1"),
     value = @Queue(value = "queue-1", durable = "true"),
     durable = "true",
     type = "topic",
     ignoreDeclarationExceptions = "true",
     key = "springboot.*"
  ))
@RabbitHandler
public class MsgReceiver  {

    public void onMessage(Message message, Channel channel) throws Excetion {
          // 监听后的业务处理
    }

}
